<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">

      <el-form-item label="业主姓名" prop="ownerName">
        <el-input
          v-model="queryParams.ownerName"
          placeholder="请输入业主姓名"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>

      <el-form-item label="小区名称" prop="premiseName">
        <el-input
          v-model="queryParams.premiseName"
          placeholder="请输入小区名称"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item><br>
      <el-form-item label="房源类型" prop="houseType">
        <el-select v-model="queryParams.houseType" placeholder="请选择" clearable size="small">
          <el-option label="国有房产" value="1" />
          <el-option label="直管房产" value="2" />
          <el-option label="自管房产" value="3" />
          <el-option label="军队房产" value="4" />
          <el-option label="集体所有房产" value="5" />
          <el-option label="私有(自由)房产" value="6" />
          <el-option label="港、澳、台投资房产" value="7" />
          <el-option label="涉外房产" value="8" />
          <el-option label="其他房产" value="9" />
        </el-select>
      </el-form-item>


      <el-form-item label="起租日期" prop="leaseStartTime">
        <el-date-picker clearable size="small"
                        v-model="queryParams.leaseStartTime"
                        type="date"
                        value-format="yyyy-MM-dd"
                        placeholder="选择租约期限开始时间">
        </el-date-picker>
      </el-form-item>
      <el-form-item label="至" prop="leaseEndTime">
        <el-date-picker clearable size="small"
                        v-model="queryParams.leaseEndTime"
                        type="date"
                        value-format="yyyy-MM-dd"
                        placeholder="选择租约期限结束时间">
        </el-date-picker>
      </el-form-item>

      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>

    </el-form>
    <el-table v-loading="loading" :data="contractList">
      <el-table-column label="业主姓名" align="center" prop="reserve3" />
      <el-table-column label="收房合同编号" align="center" prop="sfContractNo" />
      <el-table-column label="电话" align="center" prop="reserve4" />
      <el-table-column label="小区" align="center" prop="premiseName" />

      <el-table-column label="起租日期" align="center" prop="leaseStartTime" width="180">

      </el-table-column>
      <el-table-column label="结束日期" align="center" prop="leaseEndTime" width="180">

      </el-table-column>
      <el-table-column label="押付方式" align="center" prop="depositType">
        <template slot-scope="scope">
          <span v-if="scope.row.depositType==1">押1付1</span>
          <span v-if="scope.row.depositType==2">押1付2</span>
          <span v-if="scope.row.depositType==3">押1付3</span>
          <span v-if="scope.row.depositType==4">押1付4</span>
        </template>
      </el-table-column>
      <!--<el-table-column label="支付方式(押X付Y的Y）" align="center" prop="paymentType" />-->
      <el-table-column label="押金" align="center" prop="depositMoney" />
      <el-table-column label="租金" align="center" prop="monthRent" />

      <el-table-column label="状态" align="center" prop="status">
        <template slot-scope="scope">
          <span v-if="scope.row.status==1" style="color: red">草稿</span>
          <span v-if="scope.row.status==2" style="color: red">已提交</span>
          <span v-if="scope.row.status==3" style="color: red">已解约</span>
          <span v-if="scope.row.status==4" style="color: red">已结束</span>
          <span v-if="scope.row.status==9" style="color: red">作废</span>
        </template>
      </el-table-column>

    </el-table>

    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

  </div>
</template>

<script>
import { listOwner, getContract, delContract, addContract, updateContract } from "@/api/houseClosing/contract";

export default {
  name: "Contract",
  components: {
  },
  data() {
    return {
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 【请填写功能名称】表格数据
      contractList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        ownerName: null,
        houseType: null,
        premiseName: null,
        leaseStartTime: null,
        leaseEndTime: null,
      },
    };
  },
  created() {
    this.getList();
  },
  methods: {
    /** 查询【请填写功能名称】列表 */
    getList() {
      this.loading = true;
      listOwner(this.queryParams).then(response => {
        this.contractList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        sfContractNo: null,
        outContractNo: null,
        lastContractId: null,
        lastContractNo: null,
        businessId: null,
        deptId: null,
        deptNo: null,
        premiseName: null,
        houseId: null,
        houseName: null,
        houseType: null,
        houseZsNo: null,
        cqAddress: null,
        ownerId: null,
        ownerName: null,
        signWithOwner: null,
        ownerIdCard: null,
        ownerMobile: null,
        ownerContactAddress: null,
        signUserName: null,
        signUserIdCard: null,
        signUserMobile: null,
        signUserEmergencyPhone: null,
        bankCard: null,
        bankUserName: null,
        bankUserIdCard: null,
        bankId: null,
        bankName: null,
        bankOpen: null,
        leaseStartTime: null,
        leaseEndTime: null,
        monthRent: null,
        depositMoney: null,
        depositType: null,
        paymentType: null,
        conSignTime: null,
        conInfoTime: null,
        conAudTime: null,
        operId: null,
        sfUserId: null,
        sfUserName: null,
        status: 0,
        xyStatus: 0,
        sfLoanFlg: null,
        freezeStatus: 0,
        accountType: null,
        bankCardNumber: null,
        accountName: null,
        bankBranchCodeLh: null,
        bankAccountProvince: null,
        remark: null,
        delFlg: null,
        createUserid: null,
        createTime: null,
        updateUserid: null,
        updateTime: null,
        houseLeaseType: null
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
  }
};
</script>
